package com.bi.bitest.bao.tasks;

import com.bi.bitest.bao.Client.ClientAPI;
import com.bi.bitest.bao.Constants;
import com.bi.bitest.bao.utils.EntityParseUtil;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created
 * Author:bi[FR]
 * Date:15-10-25
 */
public class AlbumPlayTask extends BaseTask {
    private String trackId;
    public AlbumPlayTask(TaskCallback callback,String trackId) {
        super(callback);
        this.trackId=trackId;
    }
    @Override
    protected TaskResult doInBackground(String... params) {
        TaskResult ret=new TaskResult();
        ret.action= Constants.TASK_ALBUM_PLAY;
        JSONObject jsonObject= ClientAPI.getAlbum_Play(trackId);

        if(jsonObject!=null){
            try {
                ret.retCode=jsonObject.getInt("ret");
                ret.data= EntityParseUtil.parseAlbum_Play(jsonObject);
            } catch (JSONException e) {
                e.printStackTrace();
            }

        }
        return ret;
    }
}
